package dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import pojo.Book;
import pojo.Book2;
import pojo.Page;

import java.util.List;

public interface BookMapper {
    @ResultMap("bookResultMap")
    List<Book> selectRandomIndex();

    int adminDeleteBook(@Param("id") String id);

    int adminUpdateBook(@Param("id") String id,@Param("name") String name ,@Param("price") double price);

    @ResultMap("book2ResultMap")
    List<Book2> selectBookList();

    @ResultMap("bookResultMap")
    List<Book> selectClassBook(@Param("bookType") String bookType, @Param("page") int page);
    @ResultMap("book2ResultMap")
    List<Book2> selectClassBook2(@Param("bookType") String bookType);

    Page selectClassBookPage(@Param("bookType") String bookType);

    @ResultMap("bookResultMap")
    List<Book> selectBook(@Param("name") String name, @Param("page") int page);

    Page selectBookPage(@Param("name") String name);

    @ResultMap("bookResultMap")
    Book selectBookDetail(@Param("id") String id);

    @ResultMap("bookResultMap")
    List<Book> selectShopping(@Param("username") String username);

    int addShopping(@Param("userId") long userId,
                    @Param("bookName") String bookName,
                    @Param("author") String author,
                    @Param("price") double price,
                    @Param("imageName") String imageName,
                    @Param("bookId") String bookId);

    @ResultMap("book2ResultMap")
    Book2 selectBookItem(@Param("bookId") long bookId );
}